async function FetchDevice() {
    if (!navigator.gpu) {
        throw Error("WebGPU not supported.");
    }

    const adapter = await navigator.gpu.requestAdapter();
    if (!adapter) {
        throw Error("Couldn't request WebGPU adapter.");
    }

    const device = await adapter.requestDevice();
    device.lost.then(info => {
        console.error(`WebGPU device was lost: ${info.message}`);
    });

    return device;
}

export {FetchDevice};